package com.ym.controller.admin;

import com.github.pagehelper.PageInfo;
import com.ym.common.utils.page.PageDomain;
import com.ym.core.domain.APIResponse;
import com.ym.core.domain.BaseController;
import com.ym.medical.domain.entity.SysErrorLogEntity;
import com.ym.medical.domain.param.SysErrorLogQueryParam;
import com.ym.medical.domain.vo.SysErrorLogListPcVO;
import com.ym.medical.service.ISysErrorLogSV;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 异常日志Controller
 *
 * @author bird
 * @date 2020-07-15
 */
@Api(tags = "admin-异常日志")
@RestController
@RequestMapping("/system/errorLog")
public class SysErrorLogController extends BaseController {

	@Autowired
	private ISysErrorLogSV sysErrorLogService;

	@ApiOperation("查询异常日志列表")
	@GetMapping("/list")
	public APIResponse<PageInfo<SysErrorLogListPcVO>> list(SysErrorLogQueryParam queryParams) {
		PageDomain.startPage();
		List<SysErrorLogListPcVO> list = sysErrorLogService.selectListPC(queryParams);
		return successPage(list);
	}


	@ApiOperation("获取异常日志详细信息")
	@GetMapping(value = "/{id}")
	public APIResponse<SysErrorLogEntity> info(@PathVariable("id") Long id) {
		return successData(sysErrorLogService.selectById(id));
	}


}
